package com.clarence.dada.modular.system.role.entity.req;

import com.clarence.dada.core.base.BaseReq;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.List;


/**
 * 系统角色入参实例
 *
 * @author GD
 * @since  2020/11/5 下午4:32
 */
@Data
@Schema(title = "系统角色请求实例")
@EqualsAndHashCode(callSuper = true)
public class SysRoleReq extends BaseReq {

    /**
     * 主键
     */
    @NotNull(message = "角色主键不能为空", groups = {edit.class, delete.class, detail.class, updateStatus.class, grantResource.class, grantResourceV2.class, grantDataScope.class,
            grantMenuButton.class, grantMenu.class, grantButton.class, grantMenusAndButtons.class, roleBindMenuList.class, grantRoleMenus.class, grantAll.class})
    @Schema(title = "主键", example = "1")
    private Long roleId;

    /**
     * 角色名称
     */
    @NotBlank(message = "角色名称不能为空", groups = {add.class, edit.class})
    @Schema(title = "角色名称", example = "总经理")
    private String roleName;

    /**
     * 角色编码
     */
    @NotBlank(message = "角色编码不能为空", groups = {add.class, edit.class})
    @Schema(title = "角色编码", example = "superAdmin")
    private String roleCode;

    /**
     * 排序
     */
    @NotNull(message = "排序不能为空", groups = {add.class, edit.class})
    @Schema(title = "排序", example = "10")
    private BigDecimal roleSort;

    /**
     * 备注
     */
    @Schema(title = "备注", example = "备注")
    private String remark;

    /**
     * 状态（字典 1正常 2停用）
     */
    @Schema(title = "状态（字典 1正常 2停用）", example = "1")
    private Integer statusFlag;

    /**
     * 是否是系统角色：Y-是，N-否
     */
    @Schema(title = "是否是系统角色：Y-是，N-否", example = "Y")
    private String roleSystemFlag;

    /**
     * 角色类型
     */
    @Schema(title = "角色类型", example = "role_system")
    private String roleTypeCode;

    /**
     * 授权资源
     */
    @NotNull(message = "授权资源不能为空", groups = {grantResource.class})
    @Schema(title = "授权资源", example = "*********")
    private List<String> grantResourceList;

    /**
     * 授权资源，模块组包含的所有资源
     */
    @Schema(title = "授权资源，模块组包含的所有资源", example = "*********")
    private List<String> modularTotalResource;

    /**
     * 授权资源，模块组选中的资源
     */
    @Schema(title = "授权资源，模块组选中的资源", example = "*********")
    private List<String> selectedResource;

    /**
     * 授权数据
     */
    @Schema(title = "授权数据", example = "*********")
    private List<Long> grantOrgIdList;

    /**
     * 授权菜单
     */
    @NotEmpty(message = "授权菜单Id不能为空", groups = {grantMenuButton.class, grantMenusAndButtons.class, grantRoleMenus.class})
    @Schema(title = "授权菜单", example = "*********")
    private List<Long> grantMenuIdList;

//    /**
//     * 授权菜单按钮
//     */
//    @NotNull(message = "授权菜单按钮Id不能为空", groups = {grantMenuButton.class})
//    @Schema(title = "授权菜单按钮", example = "*********")
//    private List<SysRoleMenuButtonRequest> grantMenuButtonIdList;

    /**
     * 是否是新增绑定菜单，true-新增绑定菜单，false-取消绑定菜单
     */
    @NotNull(message = "是否是新增绑定菜单", groups = {grantMenu.class})
    @Schema(title = "是否是新增绑定菜单，true-新增绑定菜单，false-取消绑定菜单", example = "*********")
    private Boolean grantAddMenuFlag;

    /**
     * 绑定菜单的id
     */
    @NotNull(message = "绑定菜单的id", groups = {grantMenu.class})
    @Schema(title = "绑定菜单的id", example = "*********")
    private Long grantMenuId;

    /**
     * 模块下所有的按钮id
     */
    @Schema(title = "模块下所有的按钮id", example = "*********")
    private List<Long> modularButtonIds;

    /**
     * 模块下选中的按钮id
     */
    @Schema(title = "模块下选中的按钮id", example = "*********")
    private List<Long> selectedButtonIds;

    /**
     * 绑定标识，true-新增绑定菜单，false-取消绑定菜单
     */
    @Schema(title = "绑定标识，true-新增绑定菜单，false-取消绑定菜单", example = "*********")
    @NotNull(message = "绑定标识不能为空", groups = {grantMenusAndButtons.class, grantRoleMenus.class})
    private Boolean selectBindFlag;

    /**
     * 资源的业务类型：1-业务类型，2-系统类型
     */
    @Schema(title = "资源的业务类型：1-业务类型，2-系统类型", example = "*********")
    private Integer resourceBizType;

    /**
     * 全选标识：true-全选，false-取消全选
     */
    @Schema(title = "全选标识：true-全选，false-取消全选", example = "*********")
    @NotNull(message = "全选标识不能为空", groups = {grantAll.class})
    private Boolean totalSelectFlag;

    /**
     * 是否是管理员角色，管理员角色只能管理后台相关菜单
     */
    @Schema(title = "是否是管理员角色，管理员角色只能管理后台相关菜单", example = "*********")
    private String adminFlag;

    /**
     * 角色id集合
     */
    @Schema(title = "角色id集合", example = "*********")
    @NotEmpty(message = "角色id集合不能为空", groups = {batchQuery.class})
    private List<Long> roleIdList;

    /**
     * 参数校验分组：授权菜单和按钮
     */
    public @interface grantMenuButton {

    }

    /**
     * 参数校验分组：角色授权菜单
     */
    public @interface grantMenu {

    }

    /**
     * 参数校验分组：角色授权按钮
     */
    public @interface grantButton {

    }

    /**
     * 参数校验分组：授权资源
     */
    public @interface grantResource {

    }

    /**
     * 参数校验分组：授权资源
     */
    public @interface grantResourceV2 {

    }

    /**
     * 参数校验分组：授权数据
     */
    public @interface grantDataScope {

    }

    /**
     * 参数校验分组：授权菜单和按钮集合
     */
    public @interface grantMenusAndButtons {

    }

    /**
     * 获取角色绑定的菜单列表
     */
    public @interface roleBindMenuList {
    }

    /**
     * 绑定角色菜单
     */
    public @interface grantRoleMenus {
    }

    /**
     * 角色分配菜单，绑定全部菜单或取消绑定全部菜单
     */
    public @interface grantAll {
    }

    /**
     * 批量查询角色
     */
    public @interface batchQuery {

    }

}
